package java51_19;

import java.util.Calendar;

public class CalTest2 {

	public static void main(String[] args) {
		// Calendar
		Calendar c = Calendar.getInstance();// 当前日期
		// c.add(Calendar.DAY_OF_MONTH, 50);// 50天后
		c.add(Calendar.WEEK_OF_YEAR, -4);// 50天后
		System.out.println(c.getTime());
		// roll
		System.out.println(">>>>>>>>>>>>>>>>>");
		Calendar c2 = Calendar.getInstance();
		int days = c2.getActualMaximum(Calendar.DAY_OF_YEAR);
		System.out.println("今年有多少天？" + days);
		int weeks = c2.getActualMaximum(Calendar.WEEK_OF_YEAR);
		System.out.println("今年有多少周？" + weeks);
		int monthweeks = c2.getActualMaximum(Calendar.WEEK_OF_MONTH);
		System.out.println("本月有几周？" + monthweeks);
		System.out.println("设置到二月份：");
		c.set(Calendar.MONTH, Calendar.FEBRUARY);
		int days2 = c.getActualMaximum(Calendar.DAY_OF_MONTH);
		System.out.println("2月有多少天？" + days2);
		System.out.println(c.getTime());
		System.out.println(c.getTimeInMillis());
	}

}
